<!DOCTYPE html>
<#assign base=request.contextPath />
<html>
	<head>
		<meta charset="UTF-8">
		<title>注册</title>
		<link rel="stylesheet" type="text/css" href="${base}/statics/font1/iconfont.css"/>
		<link rel="stylesheet" type="text/css" href="${base}/statics/css1/base-pc.css"/>
		<link rel="stylesheet" type="text/css" href="${base}/statics/css1/xcommon.css"/>
		<link rel="stylesheet" type="text/css" href="${base}/statics/css1/reglogin.css"/>

		<script src="${base}/statics/js1/jquery-1.11.3.min.js"></script>
		<script src="${base}/statics/layer1/layer.js"></script>
		<script src="${base}/statics/js1/jquery.SuperSlide.2.1.js"></script>
	</head>
	<body>
		<header>
			<div class="header" style="border-bottom: 2px solid #459df5;">
			<div class="topbar">
			   <div class="top inner ">欢迎您来到亿矿云百科！</div>
			</div>
			<div class="logobar inner inwhite clearfix" >
			<h1 class="logo">
				<a href="/api/first"  target="_blank"><img src="${base}/statics/images1/logo.png"/></a>
			</h1>
			<div class="right clearfix">
				<div class="alr">
					已有账号，请 <a href="/login.html">登录</a> 
				</div>
			</div>	
			</div>
			</div>
		</header>
		<div class="regbox inner">
			<div class="item">
				<span class="n"><i class="star">*</i>姓名</span>
				<div class="txtbox">
					<input id="xingming" type="text" class="txtInp" />
				</div>
				<span class="tips">6~16个字符，不区分大小写</span>
			</div>
			<div class="item">
				<span class="n"><i class="star">*</i>密码</span>
				<div class="txtbox">
					<input id="mima" type="password" class="txtInp" />
				</div>
				<span class="tips">6~16个字符</span>
			</div>
			<div class="item">
				<span class="n"><i class="star">*</i>确认密码</span>
				<div class="txtbox">
					<input id="qrmm" type="password" class="txtInp" />
				</div>
				<span class="tips">6~16个字符</span>
			</div>
			<!--<div class="item">
				<span class="n"><i class="star">*</i>手机号</span>
				<div class="txtbox">
					<input type="text" class="txtInp" />
				</div>
				<span class="tips"><a href="javascript:;"  class="codeBtn">获取验证码</a></span>
			</div>
			<div class="item">
				<span class="n"><i class="star">*</i>短信验证码</span>
				<div class="txtbox">
					<input type="text" class="txtInp" />
				</div>
				<span class="tips"></span>
			</div>-->
			<div class="item">
				<span class="n"></span>
				<div class="txtbox">
				<input type="checkbox" checked="checked" name="" id="" value="" />
				已看过并同意
				<a href="" class="agree">《亿矿云百科服务条款》</a>
			    </div>
				<span class="tips"></span>
			</div>
			<div class="item">
				<span class="n"></span>
				<div class="txtbox">
				 <a href="" class="subBtn">提交</a>
			    </div>
				<span class="tips"></span>
			</div>
		</div>
	
		<footer>
			<div class="footer">
				<p>Copyright 2011- 2018 山东中煤集体神华科技 Inc All Rights Reserved. 鲁ICP备2125414号-1 </p>
				<p>地址：山东济宁开源路11号 </p>
				<p>客服电话：400-0733-010 Email：service@yike.com</p>
			</div>
	    </footer>
	</body>
<script>
	$(".subBtn").click(function (){
        var name = $("#xingming").val();
        var reg = /^[a-zA-Z]*$/;
        if(reg.test(name) === false){
            alert("只能输入字母，请重新输入");
            return false
        }
        var mima = $("#mima").val();
        mima = mima.replace(/(^\s*)|(\s*$)/g, '');//去除空格;

        if (mima == '' || mima == undefined || mima == null) {
            //return true;
            alert("请输入密码")
            return false
        }
        var qrmm = $("#qrmm").val();
        qrmm = qrmm.replace(/(^\s*)|(\s*$)/g, '');//去除空格;
        if (qrmm == '' || qrmm == undefined || qrmm == null) {
            //return true;
            alert("请输入确认密码")
            return false
        }
        if (qrmm != mima) {
            //return true;
            alert("两次密码不一致")
            return false
        }
        $.ajax({
            type: "POST",
            url:"/api/users/register",
            // contentType: "application/json",
            data: {name:name,passw:mima},
            success: function(r){
                if(r.code == 0){
                    alert('注册成功，请登录！');
                    window.location.href="/api/first";
                }else{
                    alert(r.msg);
                }
            }
        });
    });
</script>
</html>
